Module Module1
    Public tmp As Integer = 0
    Public res_number As String
    Public msisdn As String
    Public gnlsql As String

    Public Function is_number(ByVal var As String) As Boolean
        Dim i As Integer
        If Len(var) = 0 Then Return False
        For i = 0 To Len(var) - 1
            If Asc(var.Chars(i)) < 48 Or Asc(var.Chars(i)) > 57 Then
                Return False
                Exit Function
            End If
        Next
        Return True
    End Function

    Public Function is_prelinked(ByVal value As String, ByVal id As Integer) As Boolean
        Dim mydataset As New myDBConn()
        Dim mysql As String
        If id = 1 Then
            mysql = " select p.dn_id from eu_bill.view_directory_number dn,storage_medium sm,port p"
            mysql = mysql & " where sm.sm_id=p.port_id"
            mysql = mysql & " and p.dn_id=dn.dn_id"
            mysql = mysql & " and sm.sm_serialnum='" & value & "'"
            Dim x As Integer = mydataset.myORATable(mysql).Rows.Count()
            If x > 0 Then
                Return True
            Else
                Return False
            End If
        ElseIf id = 2 Then
            mysql = " select p.dn_id from eu_bill.view_directory_number dn,port p"
            mysql = mysql & " where dn.dn_id=p.dn_id"
            mysql = mysql & " and dn.dn_num='" & value & "'"
            Dim y As Integer = mydataset.myORATable(mysql).Rows.Count()
            If y > 0 Then
                Return True
            Else
                Return False
            End If

        Else
            Return False
        End If
        mydataset = Nothing

    End Function
End Module
